<template>
    <div>
        <el-select v-if="edit" @change="onChange" :placeholder="placeholder">
            <el-option label="正常" :value="2"/>
            <el-option label="停用" :value="1"/>
        </el-select>
        <el-tag v-else :type="isAvailable() ? 'success' : 'info'">
            {{ isAvailable()? '正常' :'停用' }}
        </el-tag>
    </div>
</template>

<script setup lang="ts">
interface StateProps {
    status: number,
    edit:boolean,
    placeholder:string,
    onChange: (number)=>{}
}

const props = defineProps<StateProps>()

const isAvailable = () => {
    return props.status == 2
}

</script>

<style scoped></style>
